<template>
  <div>
    <!-- 第一题 -->
    <div>
      <h1>第一题</h1>
      <code1 :code1="code1" @zou="zouyi"></code1>
    </div>
    <!-- 第二题 -->
    <div>
      <h1>第二题</h1>
      <code2 :code2="code2" @dell="dels" @shen="sheng"></code2>
    </div>
    <!-- 第三题 -->
    <div>
      <h1>第三题</h1>
      <code3 :code3="code3" @del33="del3" :isOk="isOk"></code3>
    </div>
    <!-- 第四题 -->
    <div>
      <h1>第四题</h1>
      <code4></code4>
    </div>
    <!-- 第五题 -->
    <div>
      <h1>第五题</h1>
      <code5></code5>
    </div>
    <!-- 第六题 -->
    <div>
      <h1>第六题</h1>
      <code6></code6>
    </div>
    <!-- 第q七题 -->
    <div>
      <h1>第七题</h1>
      <code7></code7>
    </div>
    <!-- 第八题 -->
    <div>
      <h1>第八题</h1>
      <code8></code8>
    </div>
    <!-- 第九题 -->
    <div>
      <h1>第九题</h1>
      <code9></code9>
    </div>
  </div>
</template>

<script>
import code1 from './components/code1.vue';
import code2 from './components/code2.vue';
import code3 from './components/code3.vue';
import code4 from './components/code4.vue';
import code5 from './components/code5.vue';
import code6 from './components/code6.vue';
import code7 from './components/code7.vue';
import code8 from './components/code8.vue';
import code9 from './components/code9.vue';
export default {
  components:{
    code1,
    code2,
    code3,
    code4,
    code5,
    code6,
    code7,
    code8,
    code9,
  },
  methods:{
   zouyi(){
    this.code1.push(this.code1[0])
    this.code1.splice(0,1)
   },
  //  第二题
   dels(ind){
     this.code2.splice(this.code2[ind-1],1)
   },
   sheng(){
   let n= Math.floor(Math.random() * (20 - 1 + 1) + 1)
   this.code2.push(n)
   },
  //  第三题
  del3(id){
    if(this.code3.length===1){
      this.isOk=true
    }else{
      this.isOk=false
    }
  
   this.code3=this.code3.filter(item=>item.id!=id)
  },
  // 第四题
  },
data () {
  return {
    isOk:false,
    code1:['帅哥','美女','程序员'],
    code2:[1,5,6],
    code3:[
        { id: 1, name: "奔驰", time: "2020-08-01" },
        { id: 2, name: "宝马", time: "2020-08-02" },
        { id: 3, name: "奥迪", time: "2020-08-03" },
      ],
      
  }
}
}
</script>

<style>

</style>